		app.controller('HomeCtrl', function($rootScope, $location)
		{
		   $rootScope.activetab = $location.path();
		});
		 
		app.controller('SobreCtrl', function($rootScope, $location)
		{
		   $rootScope.activetab = $location.path();
		});
		 
		app.controller('ContatoCtrl', function($rootScope, $location)
		{
		   $rootScope.activetab = $location.path();
		});
		
		app.controller('Usuario', function($scope,$http){
			$scope.usuarios = [
			                   {
			                	   
			                	   
			                	   firstName:$scope.firstName,
				                   secondName:$scope.secondName,
				                   email:$scope.email,
				                   phoneNumber:$scope.phoneNumber,
				                   sexo:$scope.sexo
			                	   
//			                	   id:"1",
//			                	   firstName:"Daniel",
//				                   secondName:"Souza",
//				                   email:"soudaniel@gmail.com",
//				                   phoneNumber:"(34) 9282-5565",
//				                   sexo:"M"
				                }
			                   ];
			
			$scope.add = function(){

				var person = 
					{
			                          	   
	                	   firstName:$scope.firstName,
		                   secondName:$scope.secondName,
		                   email:$scope.email,
		                   phoneNumber:$scope.phoneNumber,
		                   sexo:$scope.sexo};
////				alert(person.id);
//				$http.get("http://localhost:5984/paulo").success(function(data){
//					alert("foi: "+data);
//				});
				
				
				$http.post("http://192.168.9.30:5984/paulo/",person).success(function(data){
					$scope.usuarios.post(person);	

				});
		
			};
			
			$scope.findAll = function(usuario) {
				
				$http.get("http://192.168.9.30:5984/paulo/82868219").success(function(data) {
					
					alert(data._rev);
				$scope.usuarios.push(data);
					
				});
				
			};
			
			
			$scope.remover = function(usuario){
				$scope.usuarios = $scope.usuarios.filter(function(item){
					if(usuario.id != item.id){
						return true;
					}
					return false;
				},0);
			};
		});